#pragma once
#include <string>
#include "../../math/size.h"
#include "../../math/vec2.h"
#include "../../math/color.h"

class UIRenderer;
class Node;

class Sprite
{
private:
    int _flag;
    Node *_node;
    std::string _rendererId;
    Size _size{100, 100};
    Vec2 _anchor{0.5, 0.5};
    Color _color{1, 1, 1, 1};
    std::string _shaderPath;
    std::string _texturePath;

    UIRenderer *_renderer;

    /**
     * @brief 获取对象的内存地址字符串
     *
     * @return std::string
     */
    std::string _getAddressString();

public:
    Sprite(Node *node);
    ~Sprite();
    void setSize(float width, float height);
    void setAnchor(float x, float y);
    void setColor(float r, float g, float b, float a);
    void setShader(std::string shaderPath);
    void setTexture(std::string texturePath);
    
    Size &size();
    Vec2 &anchor();
    Color &color();
    void update(float deltaTime);
};
